package com.library.ui;

import javax.swing.*;
import java.awt.*;

public class MainFrame extends JFrame {
    public MainFrame() {
        setTitle("图书馆管理系统");
        setSize(800, 600);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);

        JTabbedPane tabbedPane = new JTabbedPane();
        tabbedPane.addTab("图书管理", new BookManagementPanel());
        tabbedPane.addTab("读者管理", new ReaderManagementPanel());
        tabbedPane.addTab("借书", new BorrowBookPanel());
        tabbedPane.addTab("还书", new ReturnBookPanel());

        JMenuBar menuBar = new JMenuBar();
        JMenu systemMenu = new JMenu("系统管理");
        JMenuItem changePasswordItem = new JMenuItem("修改密码");
        changePasswordItem.addActionListener(e -> new ChangePasswordDialog(this));
        systemMenu.add(changePasswordItem);
        menuBar.add(systemMenu);
        setJMenuBar(menuBar);

        add(tabbedPane);
        setVisible(true);
    }
}